import React from 'react'
import AppleIcon from '@material-ui/icons/Apple';
import { Button } from '@material-ui/core';
import LinearProgress from '@material-ui/core/LinearProgress';
import './examlistitem.less'
import { useHistory } from 'react-router-dom'

export default function ExamListItem(props) {
    // console.log(props.data);
    const history = useHistory()
    const gotoPractice = (code)=>{
        history.push(`/sq/${code}`)
    }

    return (
        <div className="exam-list-item">
            <AppleIcon />
            <div className="info">
                <h4>{props.data.info}</h4>
                <p>{props.data.itemCount} / {props.data.itemCount} 题</p>
                <LinearProgress variant="determinate" value={(props.data.itemCount/props.data.itemCount) * 100} />
            </div>
            <Button onClick={()=>gotoPractice(props.data.actionCode)} variant="contained" color="primary">练习</Button>
        </div>
    )
}
